#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    char buf[] = "Hello World!\n";
    FILE *fp = NULL;

    if(NULL == (fp = fopen(argv[1], "w"))){
        perror("fopen error");
        exit(-1);
    }

    printf("open file \"%s\" success!\n", argv[1]);

    if(sizeof(buf) > fwrite(buf, 1, sizeof(buf),fp)){
        printf("fwrite error!\n");
        fclose(fp);
        exit(-1);
    }

    printf("write file \"%s\" success!\n", argv[1]);
    
    fclose(fp);
    exit(0);
}
